home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1984 September
/
1984-09.d64
/
disk tricks 4
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
1KB
|
32 lines
100 sys65517:ifpeek(781)=22thenmt$="":tm$="":goto500
110 mt$="":tm$=""
500 print"[147]"mt$" warning":print" this program will"
501 print" scratch[146] a file.":print" please make sure"
502 print" that the gazette disk[146]":printtm$" is not in the drive."
1000 fori=1to7000:next
3999 rem end: rem program 4, scratch or scratch and leave on directory
4000 print"[147]select option:"
4010 print"1. complete scratch"
4020 print"2. scratch, but leave"
4021 print" on directory"
4030 print"which one?"
4040 get a$: if a$="" then 4040
4050 a=val(a$): if a<1 or a>2 then 4040: rem reject invalid input
4060 if a=1 then b=0: rem set to permanently delete
4070 if a=2 then b=128: rem set to leave on directory
4080 input"which sector";s$: s=val(s$): if s<0 or s>19 then 4080
4090 print "what is the first byte":print"of the file you wish"
4091 print "to scratch?"
4100 input bp$: bp=val(bp$): rem input file target byte for scratch
4110 bs=(bp=2)+(bp=34)+(bp=66)+(bp=98)+(bp=130)+(bp=162)+(bp=194)+(bp=226)
4120 ifbs<>-1then4100:rem reject invalid input
4130 open 15,8,15,"i": rem open command channel to disk
4140 open8,8,8,"#": rem open direct access channel to disk
4150 print#15, "u1:"8;0;18;s: rem load sector containing file to be scratched
4160 print#15, "b-p:"8;bp: rem set buffer pointer to target address
4170 print#8, chr$(b);: rem change target file code in channel 8 buffer
4180 print#15,"u2:"8;0;18;s:rem return changed contents to target sector
4190 close 8: rem close direct access channel
4200 close 15: rem close command channel
4210 rem goto 100: rem restart display t&s program when first rem removed